﻿<%@ page contentType="text/html; charset=UTF-8" %>

<!-- 会员 充值 -->


<div class="bar_seach_div">

登录名：<input id="s_recharge_menberName"   type="text" class="box-input">&nbsp;&nbsp;
昵称：<input id="s_recharge_nickname"   type="text" class="box-input">&nbsp;&nbsp;
<input id="s_recharge" type="button" class="btns" value="查  询">
</div>

<div style="padding: 5px;"><table id="recharge_grid"></table></div>   
<div style="padding: 5px;"><div id="recharge_page"></div>

<!-- 充值界面 begin -->
<div id="recharge_dialog_index" title="充值操作"  class="easyui-dialog" >
<form id="recharge_form_index" name="recharge_form_index" style="width:520px;height:400px;" class="ui-form" method="POST">
    <div id="recharge_index_errmsg"></div>
    <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" class="jkt-tableStyle">
	<tr>
        <td class="bluetd" align="right">会员名：</td>
        <td class="bluetd" align="left">
          <input id="recharge_menberName_index"  readonly="readonly"  type="text"/>
        </td>
     </tr> 
	<tr>
        <td class="bluetd" align="right">昵称：</td>
        <td class="bluetd" align="left">
          <input id="recharge_nickname_index" readonly="readonly"  type="text"/>
        </td>
     </tr>
	<tr>
        <td class="bluetd" align="right">当前值：</td>
        <td class="bluetd" align="left">
          <input id="recharge_roses_index"  readonly="readonly"  type="text"/>
        </td>
     </tr>
	<tr>
        <td class="bluetd" align="right">充值：</td>
        <td class="bluetd" align="left">
          <input id="recharge_recharge_index"  type="text" class="easyui-numberbox" data-options="required:true" min="1" max="100" precision="4" missingMessage="必须填写1~100之间的数字"/>
        </td>
     </tr>
    <tr>
        <td colspan="2" align="center">
         <input type="button" class="btns" id="recharge_index_bt" value="提  交" style="margin-top:8px;" />&nbsp;&nbsp;
         <input type="button" class="btns" id="recharge_close" value="关  闭" style="margin-top:8px;" />
      </td>
    </tr>
</table>
</form>
</div> 
<!-- 充值界面 end -->

<script>

	//关闭弹出窗口
	closeUIDialog('recharge_dialog_index');
    var rechargevalidate,rechargeids='',rechargesave=true;//本页面变量
     /**jqGrid列表*/
	jQuery("#recharge_grid").jqGrid({
		// caption: 
	    //     '<a href="javascript:fun_recharge_add()"  class="easyui-linkbutton" data-options="plain:true,iconCls:\'icon-edit\'">新增</a>' +
	    //     '<a href="javascript:fun_recharge_update()" class="easyui-linkbutton" data-options="plain:true,iconCls:\'icon-save\'">充值</a>' +
	    //     '<a href="javascript:fun_recharge_delete()" class="easyui-linkbutton" data-options="plain:true,iconCls:\'icon-cancel\'">删除</a>',
        datatype: "json", //JSON格式数据
        hidegrid: false, //不显示收缩
        url:'barapp/VipMain/list.do', //请求后台返回列表数据的URL 
        forceFit: false,//调整宽度不改变表格宽度
        //width: jqGridWidth,   //resources/js/constant.js
        //height: jqGridHeight, //resources/js/constant.js
        autowidth:false,   //取消容器的自动宽度
        colNames:[
        '编号'
        ,'会员名' 
        ,'昵称' 
        ,'玫瑰鲜花数'
        ,'登录次数' 
        ,'创建时间'
        ,'充值时间'
        //,'操作'
	    ],
	    //要呈现字段的属性设置  
	    //sortable:设置该字段是否进行排序,sorttype:排序的数据类型 
        colModel:[
        {name:'id',index:'id', width:2,sorttype:'int',sortable:false}  
        ,{name:'menberName',index:'menberName',width:120,sortable:false}
        ,{name:'nickname',index:'nickname',width:80,sortable:false}
        ,{name:'roses',index:'roses',width:60,sortable:false}
        ,{name:'logincount',index:'logincount',width:60,sortable:false}
        ,{name:'createTimeString',index:'createTimeString',width:120,sortable:false}
        ,{name:'updateTimeString',index:'updateTimeString',width:90,sortable:false}
        ],
        multiselect: true,//禁止多选
        multiboxonly:true,
        toolbar:[true,'top'],
        rowNum:10, 
        rowList:[10,20,30,50,100,500,1000,2000], 
        viewrecords: true, 
        sortname:  "id" , //默认排序的列名
        sortorder: "desc", 
        pager: '#recharge_page', 
        jsonReader: {     
          root: 'dataRows',   
          repeatitems : false     
        }
    })
    
    $("#t_recharge_grid").removeClass("ui-userdata ui-state-default"); //删样式
	$("#t_recharge_grid").append("<div style='height:32px;' class='ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix'><span class='ui-jqgrid-title'>"
		+"<a data-options='plain:true,iconCls:\'icon-edit\'' class='easyui-linkbutton l-btn l-btn-plain' href='javascript:fun_recharge_update()' group='' id=''><span class='l-btn-left'><span class='l-btn-text icon-edit l-btn-icon-left'>会员充值</span></span></a>"
	    +"</span></div> ");//列表头

    jQuery("#recharge_grid").jqGrid('hideCol',['id']);//隐藏列
    $("#recharge_grid").closest(".ui-jqgrid-bdiv").css({ 'overflow-x' : 'hidden' });//隐藏横向滚动条
    
    var recharge_list_saveflag = true;
    
    /***/
    $('#recharge_index_bt').unbind('click');
    
 
    /**充值操作*/
    function fun_recharge_update(){
        var id =$("#recharge_grid").jqGrid('getGridParam','selrow');
        if(typeof(id) =="string"){
            rowData=jQuery("#recharge_grid").jqGrid('getRowData',id);  
		    //$("#recharge_dialog_index").dialog('option' , 'title',['充值 酒吧活动管理']);
		    $("#recharge_form_index")[0].reset();
		    //rechargevalidate.resetForm(); //重置验证状态
		    //$("#recharge_dialog_index").dialog("open");
		    openUIDialog('recharge_dialog_index', true, 560, 440);
            load_recharge_data();
            rechargesave=false;
        }else{
       	 $.messager.alert('操作提示', '请至少选择一条记录再操作!'); 
        }
	}
    /**充值加载数据*/
	function load_recharge_data(){
	  //$("#recharge_activityTime_index").val(rowData.activityTime);menberName nickname roses
	  $("#recharge_menberName_index").val(rowData.menberName);
	  $("#recharge_nickname_index").val(rowData.nickname);
	  $("#recharge_roses_index").val(rowData.roses); 
	}
    /**点击按妞*/
    $('#recharge_index_bt').click(function(){
    	recharge_update_submit();
     })
    //关闭窗口
    $('#recharge_close').click(function(){
        $("#recharge_dialog_index").dialog('close');
    })     
   //充值提交
   function  recharge_update_submit(){
    
       var rechargeJson="{'id':'"+rowData.id+"','recharge':'"+$('#recharge_recharge_index').val()+"'}";  
       $.ajax({
           type: "POST",
           url:"barapp/VipMain/recharge.do",
           data:{
               rechargeJson : rechargeJson
           },
           dataType: "json",
           contentType: "application/x-www-form-urlencoded; charset=UTF-8",
           success:function(json){
               if(json.success){
                   $("#recharge_grid").trigger("reloadGrid");
                   $.messager.alert('操作提示', '操作成功!'); 
               }else{
              	 $.messager.alert('操作提示', '操作失败!'); 
               }
           }
      })
   }
	
	//注意:web服务器 utf-8配置
	$('#s_recharge').click(function(){
         var s_menberName=encodeURI($('#s_recharge_menberName').val());
         var s_nickname  =encodeURI($('#s_recharge_nickname').val());
         $("#recharge_grid").setGridParam({url:'barapp/recharge/list.do?s_menberName='+s_menberName+'&s_nickname='+s_nickname});
         $("#recharge_grid").trigger("reloadGrid");
    })
    
    /** jqgrid宽度高度自适应 begin */ 
    doResize();
	var t=document.documentElement.clientWidth;  
	window.onresize = function(){  
		if(t != document.documentElement.clientWidth){ 
		t = document.documentElement.clientWidth; 
		doResize(); 
		} 
	} 
    
	function doResize() { 
		var ss = getPageSize(); 
		$("#recharge_grid").jqGrid('setGridWidth', ss.WinW-350).jqGrid('setGridHeight', ss.WinH-300); 
	}
	
	function getPageSize() { 
		//http://www.blabla.cn/js_kb/javascript_pagesize_windowsize_scrollbar.html 
		var winW, winH; 
		if(window.innerHeight) {// all except IE 
		winW = window.innerWidth; 
		winH = window.innerHeight; 
		} else if (document.documentElement && document.documentElement.clientHeight) {// IE 6 Strict Mode 
		winW = document.documentElement.clientWidth; 
		winH = document.documentElement.clientHeight; 
		} else if (document.body) { // other 
		winW = document.body.clientWidth; 
		winH = document.body.clientHeight; 
		}  // for small pages with total size less then the viewport  
		return {WinW:winW, WinH:winH}; 
	}
	/** jqgrid宽度高度自适应 begin */
     
</script>
